package com.java.jetpackdemo.databinding

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel

class MyViewModel : ViewModel() {
    public var number = 0

    public var linkNumber: MutableLiveData<Int> = MutableLiveData()

    init {
        linkNumber.value = 0
    }


    public fun add() {
//        kotlin中加代表plus
        linkNumber.value = linkNumber.value?.plus(1)
    }

    public fun reduce(){
        linkNumber.value = linkNumber.value?.minus(1)
    }


}